<!DOCTYPE html>
<!-- 在下面的下拉菜单中的PHP 1班后面加入“PHP 2班”和“PHP 3班”，在美工 1班后面加入“美工 2班”和“美工 3班”。
 -->
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
	function addOption() {
		debugger;
		var select = getById("mySelect")
		var x = document.createElement("option");
		x.text = ("PHP2班")
		select.add(x,1)
		var x = document.createElement("option");
		x.text = ("PHP3班")
		select.add(x,2)
		
		var x = document.createElement("option");
		x.text = ("美工2班")
		select.add(x)
		
		var x = document.createElement("option");
		x.text = ("美工3班")
		select.add(x)
		
	}
	function getById(id){
		return document.getElementById(id);
	}
</script>
</head>
<body>
	<select id="mySelect">
		<option>PHP1班</option>
		<option>美工1班</option>

	</select>
	<input type="button" value="添加" onclick="addOption()">
</body>
</html>